How to Start and End a KCL Session

KCL on Unix is invoked by the Shell command kcl.

          % kcl
          KCL (Kyoto Common Lisp)  July 1, 1985

————Note to KCL/AOS users————


KCL/AOS is invoked by the CLI command KCL.



) KCL
KCL (Kyoto Common Lisp) July 1, 1985



—————End of Note—————



When invoked, KCL will print the banner and initialize the system. The date in the KCL banner identifies the revision of KCL. ``July 1, 1985'' is the value of the function lisp-implementation-version.


If there exists a file named init.lsp in the current working directory, KCL successively evaluates the forms in the file, immediately after the system initialization. The user may set up his or her own KCL environment (e.g., the memory configuration) with init.lsp.


After the initialization, KCL enters the top-level loop and prints the prompt `>'.

          >

The prompt indicates that KCL is now ready to receive a form from the terminal and to evaluate it.

Usually, the current package (i.e., the value of *package*) is the user package, and the prompt appears as above. If, however, the current package is other than the user package, then the prompt will be prefixed by the package name.



package-name>



To exit from KCL, call the function bye (or by).

          >(bye)
          Bye.
          %

————Note to KCL/AOS users————



In this report, we sometimes assume that KCL is invoked from the Unix Shell. In particular, we use the standard prompt of the Unix Shell `%' in most examples.



—————End of Note—————



Alternatively, you may type ˆD (control-D), i.e., press the key D while pressing down the control key.

          >^Dbye.
          %

The top-level loop of KCL is almost the same as that defined in Section 20.2 of the Common Lisp Reference Manual. Since the input from the terminal is in line mode, each top-level form should be followed by a newline. If more than one value is returned by the evaluation of the top-level form, the values will be printed successively. If no value is returned, then nothing will be printed.



        >(values 1 2)
        1
        2

        >(values)

        >



When an error is signalled, control will enter the break loop.

        >(defun foo (x) (bar x))
        foo

        >(defun bar (y) (bee y y))
        bar
 
        >(foo 'lish)
        Error: The function BEE is undefined.
        Error signalled by BAR.

        Broken at BAR.
        >>



`> >' in the last line is the prompt of the break loop. Like in the top-level loop, the prompt will be prefixed by the current package name, if the current package is other than the user package.


To go back to the top-level loop, type :q



        >>:q

        Top level.
        >



See Section 5.4 for the details of the break loop.


In KCL on Unix, the terminal interrupt (usually caused by typing ˆC (control-C) or by typing DELETE) is a kind of error. It breaks the running program and calls the break level loop.



Example:

        >(defun foo () (do () (nil)))
        foo

        >(foo)
        ^C
        Correctable error: Console interrupt.
        Signalled by DO.

        Broken at FOO.
        >>



————Note to KCL/AOS users————


In KCL/AOS, the console interrupt caused by typing ˆC (control-C) followed by ˆA (control-A) is a kind of error. Typing ctrlC and ˆA breaks the running program and calls the break loop. On the other hand, the console interrupt caused by ˆC and ˆB (control-B) will immediately terminate KCL.



Example:



        >(defun foo () (do () (nil)))
        foo

        >(foo)
        ^C^A
        Correctable error: Console interrupt.
        Signalled by DO.

        Broken at FOO.
        >>(foo)
        ^C^B
	*ABORT*
	CONSOLE INTERRUPT
	ERROR: FROM PROGRAM
        LEVEL 1
	x,kcl
	)



—————End of Note—————